1 2 3 4 5 6 7 8 9 10 11 12 13
| NSLog(@"absoluteURL--%@",requestURL.absoluteURL);//绝对NSurl NSLog(@"absoluteString--%@",requestURL.absoluteString);//绝对url字符串 NSLog(@"scheme--%@",requestURL.scheme);//协议 NSLog(@"user--%@",requestURL.user);//用户名 NSLog(@"password--%@",requestURL.password);//密码 NSLog(@"baseUrl--%@",requestURL.baseURL);//根目录、只有在通过跟目录生成的url中才会体现 NSLog(@"resourceSpecifier--%@",requestURL.resourceSpecifier);//资源说明符 NSLog(@"relativeString--%@",requestURL.relativeString);//相对路径(带参数)、如果没有baseUrl。则全部显示 NSLog(@"relativePath--%@",requestURL.relativePath);//相对路径、不带参数 NSLog(@"host--%@",requestURL.host);//主机域名 NSLog(@"port--%@",requestURL.port);//端口 NSLog(@"query--%@",requestURL.query);//参数 NSLog(@"fragment--%@",requestURL.fragment);//锚点、可以在网站打开时候直接移动至此
|
输出结果:
pcautobrowser://information-article/11141215
1 2 3 4 5 6 7 8 9 10 11 12 13
| absoluteURL--pcautobrowser: absoluteString--pcautobrowser: scheme--pcautobrowser user--(null) password--(null) baseUrl--(null) resourceSpecifier-- relativeString--pcautobrowser: relativePath--/11141215 host--information-article port--(null) query--(null) fragment--(null)
|
pcautobrowser://model/76313?serialId=9550&serialName=A3&modelName=201Sportback
1 2 3 4 5 6 7 8 9 10 11 12 13
| absoluteURL--pcautobrowser: absoluteString--pcautobrowser: scheme--pcautobrowser user--(null) password--(null) baseUrl--(null) resourceSpecifier-- relativeString--pcautobrowser: relativePath--/76313 host--model port--(null) query--serialId=9550&serialName=A3&modelName=201Sportback fragment--(null)
|
https://github.com/evgenyneu/ios-javascriptcore-demo
JavaScript实现http地址自动检测并添加URL链接
Get parts of a NSURL in objectivec
Best way to parse URL string to get values for keys?
Creating URL query parameters from NSDictionary objects in ObjectiveC
Url minus query string in objectivec
https://stackoverflow.com/questions/37684/how-to-replace-plain-urls-with-links
https://stackoverflow.com/questions/1500260/detect-urls-in-text-with-javascript